package com.hxzy.controller.admin;

import com.hxzy.common.vo.R;
import com.hxzy.service.system.CityAreaService;
import com.hxzy.vo.CityAreaTreeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Administrator
 */
@Api(tags = "县市区API")
@RestController
@RequestMapping(value = "/api/cityarea")
public class CityAreaController extends BaseController{

    @Autowired
    private CityAreaService cityAreaService;

    @ApiOperation(value = "县ID加载数据")
    @GetMapping(value = "/province/{codeId}")
    public R cityAreaById(@PathVariable(value = "codeId") String codeId){
        List<CityAreaTreeVO> arr=new ArrayList<>();

        CityAreaTreeVO cityAreaTreeVO = this.cityAreaService.selectByParentAreaCode(codeId);

        arr.add(cityAreaTreeVO);

        return R.okHasData(arr);
    }


}
